
<template tag="以下文档内容为hycli自动生成">
  <el-dialog
    v-model="conf.visible"
    
    title="修改我的便签"
    :width="conf.width"
    draggable
    align-center="true"
    :close-on-click-modal="false"
    :before-close="hide"
  >
<el-form :model="form"  ref="form" :rules="rules_ayp">
    <el-row>
    <el-col :span="24">
    <!--内容 输入控件 -->
    <el-form-item prop="text" label="内容" label-width="100px" label-position="right">
      <el-input clearable style="width: 100%" v-model="form.text"  maxlength="2000" 
      :rows="0"  type="textarea" show-word-limit 
        placeholder="请输入内容"  />
    </el-form-item>
    </el-col>
    </el-row>
</el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="hide" icon="close">取消</el-button>
        <el-button type="primary" @click="save" icon="select">提交</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script>
import rtext from "@/views/cmpnts/rtext.vue"
export default {
  components: {
    rtext
},
  data() {
    return {
      conf: {
        visible: false,
        width:"60%",
        uploadPath:this.$theia.env.join("/file/upload"),
      },
rules_ayp:{
    text:[{required:true,message:"请输入内容",trigger: 'blur'}],
  },
    form:{
        text:"",
    },
    }
  },
  methods: {
    show(form) {
      this.conf.visible = true;
      this.loadEnums_ayp()
      this.form = Object.assign(form,this.$route.params)
      this.get(form)
    },
      get(form){
        let that = this
        this.conf.loading = true
        let postForm = {}
        postForm.id = form.id
        this.$theia.http.get("/ws/my/note",postForm).then(res=>{
        that.form = Object.assign(that.form, res)
      //处理枚举重新绑定
      this.loadEnums_ayp()
      that.conf.loading = false
        }).catch(res=>{
          let code = ((res||{}).response||{}).status||0
          let msg = `我的便签查询失败(${code})`
          that.$notify.error({title: '失败',message:msg ,duration:5000})
        })
    },
    save(){
        this.$refs.form.validate((v=>{
            if(v) this.onSave()
        }))
    },
    onSave(){
      let that = this
        let postForm = Object.assign({},this.form)
        this.$theia.http.put("/ws/my/note",postForm).then(res=>{
            that.$notify.success({title: '成功',message: '我的便签保存成功',duration:5000})
            that.hide()
            that.$emit("onsaved")
        }).catch(res=>{
            let code = ((res||{}).response||{}).status||0
            let msg = `我的便签修改失败(${code})`
            that.$notify.error({title: '失败',message: msg,duration:5000})
        })
    },
    hide() {
      this.conf.visible = false;
      this.$refs.form.resetFields();
    },
     onUploadSuccess(response){
    },
    loadEnums_ayp(){
    },

  },
};
</script>

<style scoped>
.form_item_info{
  margin-left: 4px;
  color:#999;
}
.form_item_info:hover{
  cursor: pointer;
  font-weight: 500;
  color:#333;
}
</style>